package pneuservis.frontend.web;

import java.util.Collection;
import java.util.Locale;
import net.sourceforge.stripes.validation.TypeConverter;
import net.sourceforge.stripes.validation.ValidationError;
import org.apache.shiro.crypto.hash.Sha256Hash;

public class PasswordTypeConverter implements TypeConverter<String> {

    @Override
    public String convert(String input, Class<? extends String> cls,
            Collection<ValidationError> errors) {
        return hash(input);
    }

    public String hash(String password) {
        
        return (new Sha256Hash(password)).toHex();
    }

    @Override
    public void setLocale(Locale locale) {
    }
}